/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>CreateTime: 2006-4-19 </p>
 * @author pengz
 * @version 1.0
 */

package cn.agiledata.bank.myspace.service;


import cn.agiledata.bank.common.dao.AccountTemplateInter;
import cn.agiledata.bank.common.dao.BankTemplate;
import cn.agiledata.bank.common.dao.TransactionTemplate;
import cn.agiledata.bank.hibernateBean.Account;

import com.vnv.infrastructure.email.bean.RegisterActivateBean;
import com.vnv.infrastructure.email.service.IMailService;
import com.vnv.infrastructure.email.service.VNVMail;
import com.vnv.infrastructure.logic.IPBHibernate3BaseMgr;

public class SendMailServiceImpl extends IPBHibernate3BaseMgr implements
		ISendMailService {
	private TransactionTemplate tt;

	private AccountTemplateInter at;

	private BankTemplate bt;
	
	private IMailService mailService;


	
	public void sendRegisterActivateReport(String accountID) {
		Account a = at.getAccount(accountID);
		RegisterActivateBean rab = new RegisterActivateBean();
		rab.setUserMail(a.getEmail());
		

		try {
			VNVMail email = new VNVMail();
			email.setTemplateName(rab.getTemplate());
			email.setContext(rab);
			email.setSubject(rab.getSubject());
			email.setEmailTo(a.getEmail());
			mailService.sendMail(email);

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public AccountTemplateInter getAt() {
		return at;
	}

	public void setAt(AccountTemplateInter at) {
		this.at = at;
	}

	public BankTemplate getBt() {
		return bt;
	}

	public void setBt(BankTemplate bt) {
		this.bt = bt;
	}

	public TransactionTemplate getTt() {
		return tt;
	}

	public void setTt(TransactionTemplate tt) {
		this.tt = tt;
	}

	public IMailService getMailService() {
		return mailService;
	}

	public void setMailService(IMailService mailService) {
		this.mailService = mailService;
	}


}
